package angle;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import common.BaseAction;
import entities.TCurrency;
import interfaces.ICurrencyService;

public class CurrencyAngle extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7507534255609348887L;

	private ICurrencyService currencyService;

	private TCurrency currencyBean;
	private List<TCurrency> currencyList;

	private String curNo;
	private String curNos;
	private String curName;
	private Double curRate;
	private String curState;
	private Date curDate;
	private Date curDateTop;
	private Date curDateEnd;
	private String curRemark;

	// 展示对象
	public void rate() throws Exception {
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("text/html;charset=UTF-8");
		if (!currencyService.exist(curNo)) {
			response.getWriter().println("1.0000");
		} else {
			currencyBean = currencyService.fetch(curNo);
			response.getWriter().println(currencyBean.getCurRate());
		}
	}


	////////////////////// ---------------------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////
	////////////////////// ---------------------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////
	////////////////////// ---------------------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////

	public ICurrencyService getCurrencyService() {
		return currencyService;
	}

	public void setCurrencyService(ICurrencyService currencyService) {
		this.currencyService = currencyService;
	}

	public TCurrency getCurrencyBean() {
		return currencyBean;
	}

	public void setCurrencyBean(TCurrency currencyBean) {
		this.currencyBean = currencyBean;
	}

	public List<TCurrency> getCurrencyList() {
		return currencyList;
	}

	public void setCurrencyList(List<TCurrency> currencyList) {
		this.currencyList = currencyList;
	}

	public String getCurNo() {
		return curNo;
	}

	public void setCurNo(String curNo) {
		this.curNo = curNo;
	}

	public String getCurNos() {
		return curNos;
	}

	public void setCurNos(String curNos) {
		this.curNos = curNos;
	}

	public String getCurName() {
		return curName;
	}

	public void setCurName(String curName) {
		this.curName = curName;
	}

	public Double getCurRate() {
		return curRate;
	}

	public void setCurRate(Double curRate) {
		this.curRate = curRate;
	}

	public String getCurState() {
		return curState;
	}

	public void setCurState(String curState) {
		this.curState = curState;
	}

	public Date getCurDate() {
		return curDate;
	}

	public void setCurDate(Date curDate) {
		this.curDate = curDate;
	}

	public Date getCurDateTop() {
		return curDateTop;
	}

	public void setCurDateTop(Date curDateTop) {
		this.curDateTop = curDateTop;
	}

	public Date getCurDateEnd() {
		return curDateEnd;
	}

	public void setCurDateEnd(Date curDateEnd) {
		this.curDateEnd = curDateEnd;
	}

	public String getCurRemark() {
		return curRemark;
	}

	public void setCurRemark(String curRemark) {
		this.curRemark = curRemark;
	}

}
